package de.tabuma.customer.view;

import de.tabuma.lib.tabumaview;
import de.tabuma.customer.*;
import java.io.PrintWriter;
import java.util.*;
import java.util.logging.*;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author alefen
 */
public class view extends tabumaview {

    private static final Logger log = Logger.getLogger(view.class.getName());

    public view(String servlet, Hashtable parameter) {
        super(servlet, parameter);
    }

    @Override
    public void processRequest(ServletContext context, HttpServletRequest request, HttpServletResponse response, PrintWriter out) {

        String name = "costumer list";
        out.println("<div class=\"contentHeader\">"+name+"</div>");

        String param = (String) request.getAttribute(constants.paramName);
        if(param==null) {
            param = "" + constants.ACTION_LIST;
        }

        int paramInt = Integer.valueOf(param).intValue();
        
        switch(paramInt) {
            case constants.ACTION_LIST:
                listView listView = new listView(this.getServlet(), this.getParameter());
                listView.processRequest(context, request, response, out);
                break;
            case constants.ACTION_CREATE:
                createView createView = new createView(this.getServlet(), this.getParameter());
                createView.processRequest(context, request, response, out);
                break;
            case constants.ACTION_REMOVE:
                removeView removeView = new removeView(this.getServlet(), this.getParameter());
                removeView.processRequest(context, request, response, out);
                break;
            case constants.ACTION_UPDATE:
                updateView updateView = new updateView(this.getServlet(), this.getParameter());
                updateView.processRequest(context, request, response, out);
                break;
        }
    }



}
